package com.acwing.partition13;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/3/9 9:02
 */
public class AC1226包子凑数 {

    private static final int N = 10010;
    private static boolean[] f = new boolean[N];
    private static int[] nums = new int[110];
    private static int n;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = Integer.parseInt(reader.readLine());
        int d = 0;
        for (int i = 0; i < n; i++) {
            nums[i] = Integer.parseInt(reader.readLine());
            d = gcd(d, nums[i]);
        }
        if (d != 1) writer.write("INF\n");
        else {
            f[0] = true;
            for (int i = 0; i < n; i++) {
                for (int j = nums[i]; j < N; j++) {
                    f[j] |= f[j - nums[i]];
                }
            }
            int ans = 0;
            for (int i = 0; i < N; i++) {
                if (!f[i]) ans++;
            }
            writer.write(ans + "\n");
        }
        writer.flush();
    }

    private static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }
}
